using System;
using System.Linq;
using Dqaqs.Common;

namespace ProfileTableDqEstimator
{
    internal static class ProfTableQueryHelper
    {
        public static ProfTableQuery Parse(string query)
        {
            ArgumentCheck.NotNullOrEmpty(query, "query");
            var tpls = from p in query.Split("^".ToCharArray())
                       let t = p.Split("=".ToCharArray())
                       select Tuple.Create(t[0].Trim(), t[1].Trim().Trim("\"".ToCharArray()).Trim("'".ToCharArray()));
            return new ProfTableQuery().SetConditions(tpls);
        }
    }
}